package com.yukh.test.hibernate;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.junit.Test;

public class HibernateDemo {
	
	@Test
	public void initHiber(){
		Configuration cf = new Configuration().configure("com/yukh/test/hibernate/hibernate.cfg.xml");
		SessionFactory sf = cf.buildSessionFactory();
//		QueryReslutInterceptor in = new QueryReslutInterceptor("2");
		Session session = sf.openSession();
		session.beginTransaction();
		Query query = session.createQuery("from Student");
		List list = query.list();
		System.out.println("====" + list.size());
		session.getTransaction().commit();
	}
}
